package com.freechurch.view;

import java.security.interfaces.DSAKey;

import javax.swing.JDesktopPane;
import javax.swing.JFrame;
import javax.swing.JInternalFrame;

import com.freechurch.view.api.Form;
import com.freechurch.view.api.MenuBar;

public class Main extends JFrame {

	private static final long serialVersionUID = -8426919565497860197L;
	private JDesktopPane desktopPane = new JDesktopPane();
	private static Main innerInstance = null;

	private Main() {
		this.getContentPane().add(desktopPane);
		this.setJMenuBar(MenuBar.getInstance());
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setExtendedState(JFrame.MAXIMIZED_BOTH);
	}
	
	public static Main getInstance(){
		if(innerInstance==null)
			innerInstance = new Main();
		return innerInstance;
	}

	public static void main(String[] args) {
		new Main();
	}
	
	public void addFrame(Form form){
		desktopPane.add(form);
	}
	
	public void removeFrame(JInternalFrame form){
		desktopPane.remove(form);
	}
}
